import React from 'react';

export default class Form extends React.Component {
    state = {
      username: '',
    }
    onUserNameChange = (e) => {
      console.log(e.target.value)
      this.setState({ username: e.target.value })
    }
    render() {
      const { username } = this.state;
      
      return (
        <form>
          <input
            type="text"
            onChange={this.onUserNameChange}
            value={username}
            placeholder="用户名"
          />
  
          <input type="submit" value="提交" />
        </form>
      )
    }
  }